<template>
  <div class="all">
    <Nav :leftShow="left_show" :leftName="left_name" :rightName="right_name" :titleName="title_name">
    </Nav>
    <div class="top">
      <div class="head top1">
        <span class="zi">头像</span>
        <img src="//elm.cangdu.org/img/default.jpg" alt="" class="head1">
        <i class="iconfont icon-jiantou"></i>
      </div>
      <div class="head">
        <span class="zi">用户名</span>
        <i class="iconfont icon-jiantou"></i>
        <span style="float: right; margin-right: 20px;">{{name}}</span>
      </div>
      <div class="head">
        <span class="zi">收货地址</span>
        <span></span>
        <i class="iconfont icon-jiantou"></i>
      </div>
    </div>
    <div class="bound">
      账号绑定
    </div>
    <div class="head">
      <span>手机</span>
      <i class="iconfont icon-shouji"></i>
      <i class="iconfont icon-jiantou"></i>
    </div>
    <div class="bound">
      安全设置
    </div>
    <div class="head">
      <span class="zi">
        登陆密码
      </span>
      <span class="modify">
        修改
      </span>
      <i class="iconfont icon-jiantou"></i>
    </div>
    <van-button type="primary" size="large" color="#d8584a" @click="clickAction">退出登录</van-button>
  </div>
</template>
<script>
  import Nav from "@/components/Nav.vue";
  export default {
    name: "accountmessage",
    data() {
      return {
        name: localStorage.getItem("name"),
        left_show: false,
        left_name: '空',
        title_name: '账户信息',
        right_name: '',
      }
    },
    components: {
      Nav
    },
    methods: {
      clickAction() {
        this.$dialog.confirm({
          title: '想登录嘛？',
          message: '是否退出登录',
        })
          .then(() => {
            this.axios.get('https://elm.cangdu.org/v2/signout').then(res => {
              console.log(res.data.message)
              localStorage.removeItem('name')
              this.$router.push({ name: "Mine" })
            })
          })
          .catch(() => {
            this.$router.push({ name: "Accountmessage" })
          });
      }
    },


  }
</script>
<style lang="less" scoped>
  .all {
    background-color: rgb(245, 245, 245);
    margin-top: 40px;
  }

  .head {
    height: 50px;
    line-height: 50px;
    background-color: white;
    border-bottom: 1px solid gainsboro;
    font-size: 14px;

  }

  .zi {
    margin-left: 10px;
  }

  .top1 {
    height: 70px;
    line-height: 70px;
    border-top: 13px solid rgb(245, 245, 245);
    position: relative;
  }

  .head1 {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    float: left;
    position: absolute;
    top: 10px;
    right: 30px;
  }

  i {
    font-size: 14px;
    color: gray;
    float: right;
    margin-right: 10px;
  }

  .icon-shouji {
    float: left;
    color: rgb(16, 174, 255);
    font-size: 20px;
    margin-left: 10px;
  }

  .bound {
    padding: 8px;
    font-size: 13px;
    color: rgb(94, 91, 91);
  }

  .modify {
    margin-left: 240px;
    color: gray;
    font-size: 16px;
  }

  .van-button {
    margin-top: 30px;
    width: 90%;
    margin-left: 5%;
    height: 35px;
    line-height: 35px;
    border-radius: 5px;
    font-size: 15px;
  }
</style>